/**
 * 
 */
package com.ruyipu.forum.base;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * @author donald
 *
 */
public class FileReader {
	public static final String TAG = FileReader.class.getSimpleName();
	public static final String NAME = FileReader.class.getName();
	
	private FileReader(){}
	
	public static String readFile(String fileName) {
		String content = "";
		File file = new File(fileName);
		try {
			InputStream is = new FileInputStream(file);
			InputStreamReader isrReader = new InputStreamReader(is);
			BufferedReader bReader = new BufferedReader(isrReader);
			String sLine = null;
			while (null != (sLine = bReader.readLine())) {
				content += sLine;
			}
		} catch (FileNotFoundException e) {
			MyLog.e(TAG, e);
		} catch (IOException e) {
			MyLog.e(TAG, e);
		}
		return content;
	}
}
